package com.initial;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.initial.entity.TbCrmBusiness;
import com.initial.entity.TbSystemUser;
import com.initial.mapper.TbCrmBusinessMapper;
import com.initial.mapper.TbCrmCustomerMapper;
import com.initial.mapper.TbSystemUserMapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;
import java.util.Scanner;

@SpringBootTest
public class Businesstest {

    @Resource
    private TbCrmBusinessMapper tbCrmBusinessMapper;
    @Resource
    private TbSystemUserMapper tbSystemUserMapper;
    @Resource
    private TbCrmCustomerMapper crmCustomerMapper;

    @Test
    public void test1() {
        IPage<TbCrmBusiness> tbCrmBusinessIPage = tbCrmBusinessMapper.selectBusiness("北京",null,null,null,new Page<>(1, 2));
        tbCrmBusinessIPage.getRecords().forEach(tbCrmBusiness -> System.out.println(tbCrmBusiness));
    }

    @Test
    public void test2() {
        System.out.println(tbCrmBusinessMapper.selectById(1));
    }

    @Test
    public void test3() {
        System.out.println(tbSystemUserMapper.selectById(1));
    }

    @Test
    public void test4() {
        List<TbSystemUser> tbSystemUsers = tbSystemUserMapper.selectList(new QueryWrapper<>());
        for (TbSystemUser tbSystemUser : tbSystemUsers) {
            System.out.println(tbSystemUser.getUsername());
        }
    }

    @Test
    public void test5() {
        System.out.println(crmCustomerMapper.selectNameAndId());
    }

    @Test
    public void test6() {
        tbCrmBusinessMapper.deleteById(1);
    }

    @Test
    public void test7() {
        System.out.println(tbSystemUserMapper.selectById(1));
    }

    @Test
    public void test8() {
        tbCrmBusinessMapper.selectName().forEach(tbCrmBusiness -> System.out.println(tbCrmBusiness));
    }
}
